//
//  ScriptData.h
//  Phidgets
//
//  Created by Daniel Hazelbaker on 12/14/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#ifndef Phidgets_ScriptData_h
#define Phidgets_ScriptData_h

#include <string>


typedef enum
{
    ScriptRunOnce = 0,
    ScriptRunDaemon = 1
} ScriptRunType;

class SqlStatement;

class ScriptData
{
private:
    int _scriptID;
    std::string _name;
    ScriptRunType _runType;
    std::string _code;
    
protected:
    void LoadFromStatement(SqlStatement *statement);
    
public:
    ScriptData() { _scriptID = -1; }
    ScriptData(unsigned int script_id);
    ScriptData(SqlStatement *statement);

    bool Save();
    bool Delete();

    int GetScriptID() { return _scriptID; }
    
    const std::string GetName() { return _name; }
    void SetName(std::string name) { _name = name; }
    
    ScriptRunType GetRunType() { return _runType; }
    void SetRunType(ScriptRunType type) { _runType = type; }

    const std::string GetCode() { return _code; }
    void SetCode(std::string code) { _code = code; }
};


#endif
